<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>解构赋值</title>
</head>
<body>
    
</body>

<script>

    //解构赋值
    //ES6 允许按照一定模式和对象中提取值，对变量赋值。

    //特性1 数组的解构
    const F4 = ['刘德华','郭富城','黎明','张学友']
    
    let [liu,guo,li,zhang] = F4;
    console.log(liu);
    console.log(guo);
    console.log(zhang);
    console.log(li);

    //特性2 对象的解构
    const liudehua = {
        name:'刘德华',
        age:'未知',
        song:function() {
            console.log('唱歌');
        }
    }

    let {name,age,song} = liudehua;
    console.log(name);
    console.log(age);
    song();




</script>

</html>